<template>
   <div>
        <textarea name="" id="" cols="30" rows="10" v-model="content"></textarea>
        <button @click="addComment">点击评论</button>
   </div>
</template>

<script>
    import * as api from "@/api/commnet"
    import { mapActions } from "vuex"
    export default{
        data(){
            return{
                content:"",
                name:"zzz"
            }
        },
        methods:{
            ...mapActions('comment',['FETCH_COMMENT']),
            async addComment(){
               let res = await api.addComment(this.content,this.name)
               console.log(res);

               if(res.data.state){
                this.FETCH_COMMENT()
               } 
            }
        }
    }
</script>